<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>反欺诈调查</title>
    <link rel="stylesheet" href="/Public/css/bootstrap.min.css">
    <link rel="stylesheet" href="/Public/css/gxxjkefu-normalize.css">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link rel="stylesheet" href="/Public/css/model.css">
    <link rel="stylesheet" href="/Public/css/pager.css">
    <style>
        body{
            font-size: 12px;
        }
        .user_name{
            cursor: pointer;
            color: black;
        }
        .user_name:hover{
            color: #31b0d5;
        }
        .notice_info {
            padding: 25px 0 3%;
            line-height: 35px;
            color: #979797;
            float: left;
            width: 100%;
            background: #ffffff;
        }

        .feedback_ul {
            text-align: center;
            margin: 0 auto 50px;
        }

        .feedback_ul li {
            text-align: center;
            display: inline-block;
            margin: 0 30px;
        }

        .feedback_ul li a {
            color: black;
            padding: 0 0 10px;
        }

        .feedback_ul .a_active {
            color: #57bee9;
            border-bottom: solid 2px #57bee9;
        }

        .search_table thead {
            background: #f0f8fa;
            border: none;
        }

        .table {
            color: #000000;
            margin: 0 auto;
            width: 100% !important;
            text-align: center;
        }

        .search_table input {
            background: none;
            border: none;
        }

        .table > thead > tr > th {
            border-bottom: none !important;
            text-align: center !important;
        }

        .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
            border-top: 1px solid #f0f8fa !important;
            text-align: center !important;
        }

        .remark_div {
            color: black;
            height: 340px;
            width: 90%;
            margin: 200px auto 0;
            position: relative;
        }

        .remark_div input {
            position: absolute;
            right: 0;
            bottom: 0;
            background: #ff815a;
            border-radius: 3px;
            border: none;
            color: white;
            margin-top: 20px;
            width: 200px;
            height: 40px;
        }

        .remark_div textarea {
            background: #f5f5f5;
            border: none;
            padding: 1%;
        }
    </style>

</head>
<body>
<div id="main_C" style="float: left;width: 100%" class="animated fadeInRight">
    <div class="title_info">
        <span>工作认证列表</span>
    </div>

    <div class="white_bgColor notice_info">
        <!--顶部选项-->
        <ul class="feedback_ul">
            <li><a href="javascript:void(0);" class="a_active">待审核</a></li>
            <li><a href="javascript:void(0);">未通过</a></li>
        </ul>
        <!--待查列表-->
        <div class="search_table">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>姓名</th>
                    <th>手机号码</th>
                    <th>创建时间</th>
                    <th>提交认证时间</th>
                    <th>备注数</th>
                    <th>执行人</th>
                    <th>详情</th>

                </tr>
                </thead>
                <tbody id="t_lst" class="animated fadeInRight">

                </tbody>
            </table>
            <div id="pageone" style="width: 1200px;text-align: center;margin: 100px auto 0">
                <ul class="pagination" id="page1"></ul>
                <div class="pageJump">
                    <span>跳转到</span>
                    <input type="text"/>
                    <span>页</span>
                    <button type="button" class="button"></button>
                </div>
            </div>
        </div>
        <!--未通过-->
        <div style="display: none" class="search_table">
            <select id="type_status" style="float: right;margin-right: 20px;margin-bottom: 5px">
                <option value="1"  selected = "selected">--已沟通--  </option>
                <option value="2"> --未沟通--  </option>
            </select>

            <table class="table table-hover">
                <thead>
                <tr>

                    <th>ID</th>
                    <th>姓名</th>
                    <th>手机号码</th>
                    <th>创建时间</th>
                    <th>提交认证时间</th>
                    <th>备注数</th>
                    <th>执行人</th>
                    <th>详情</th>
                </tr>
                </thead>
                <tbody id="t_nopass_lst" class="animated fadeInRight">

                </tbody>
            </table>
            <div id="pagetwo" style="width: 1200px;text-align: center;margin: 100px auto 0">
                <ul class="pagination" id="page2"></ul>
                <div class="pageJump">
                    <span>跳转到</span>
                    <input type="text"/>
                    <span>页</span>
                    <button type="button" class="button"></button>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>
<script src="/Public/js/jquery-3.2.1.js"></script>
<script src="/Public/js/bootstrap.min.js"></script>
<script src="/Public/js/pager.js"></script>
<script src="/Public/js/layer/layer.js"></script>
<script src="/Public/js/layui/layui.js"></script>
<script>
    //状态值改变
    var tab_index = parseInt(sessionStorage.getItem('work_tab_index'));
    var select_type=sessionStorage.getItem('work_cert_type');
    if(select_type!=1 && select_type!=2){
        sessionStorage.setItem("work_cert_type", 1);
    }

    $("#type_status").change(function () {
        var value=$(this).children('option:selected').val();
        get_list(2,1,value);
        sessionStorage.setItem("work_cert_type", value);
        console.log('9999',value);
    });

    var page = parseInt(sessionStorage.getItem('work_cert_page'));
    var survey_total = parseInt(sessionStorage.getItem('work_cert_total'));
    if(tab_index>=0 && page>1 ){
        //  返回前的页面

        console.log('00000tab_index',tab_index);
        console.log('00000page',page);
        console.log('00000survey_total',survey_total);
        if (tab_index >= 0 && page > 1) {
            if (tab_index == '' || tab_index == null) {
                tab_index = 0;
            }
            $(".search_table").hide().eq(tab_index).show();
            $(".feedback_ul").find("li a").removeClass("a_active");
            $(".feedback_ul li a").eq(tab_index).addClass("a_active");

            var index=tab_index+1;
            if(index==1){
                get_list(index,page,0);
                Page({
                    num: survey_total,					//页码数
                    startnum: page,				//指定页码
                    elem: $('#page1'),		//指定的元素
                    callback: function (n) {	//回调函数
//                        sessionStorage.setItem('work_cert_page',n);
                        get_list(index,n,0);
                    }
                });
            }

            if(index==2){
                var value=sessionStorage.getItem("work_cert_type");
                $('#type_status').val(value);
                Page({
                    num: survey_total,					//页码数
                    startnum: page,				//指定页码
                    elem: $('#page2'),		//指定的元素
                    callback: function (n) {	//回调函数
//                        sessionStorage.setItem('work_cert_page',n);
                        get_list(index,n,value);
                    }
                });
                get_list(index,page,value);
            }
        }
    }else {
        get_list(1,1,0);
    }


    function get_list(index,page,type) {
    var url = "<{$SERVER_NAME}>/WorkCert/get_cert_list";
    $.post(url, {index:index,page: page,type:type}, function (data) {
        console.log('6666666666', data);
        if (data.code == '1001') {
            var obj = data.data;
            var s = "";
            var len = obj.length;
            console.log('32232', len);
            sessionStorage.setItem("work_cert_total", data.tol);
//            work_cert_total
            if (data.count <= 10) {
                if(index==1){
                    $("#pageone").hide();
                }
                 if(index==2){
                    $("#pagetwo").hide();
                }
            }else {
                if(index==1){
                    $("#pageone").show();
                }
                if(index==2){
                    $("#pagetwo").show();
                }
            }
            var page_num="#page1";
            if(index==2){
                page_num="#page2";
            }
            sessionStorage.setItem('work_cert_page',page);
            /*分页*/
            if(page==1){
                Page({
                    num: data.tol,					//页码数
                    startnum: page,				//指定页码
                    elem: $(page_num),		//指定的元素
                    callback: function (n) {	//回调函数
                        get_list(index,n,type);
                    }
                });
            }

            for (var i = 0; i < len; i++) {
                s += " <tr>" +
                    " <td> "+obj[i].id+"</td>" +
                    " <td>  "+obj[i].user_name+"</td>" +
                    " <td>  "+obj[i].user_mobile+"</td>" +
                    " <td>  "+obj[i].ctime+"</td>" +
                    " <td>  "+obj[i].sub_time+"</td>" +
                    " <td>  "+obj[i].mark_num+"</td>" +
                    " <td>  "+obj[i].admin_name+"</td> " +
                    "<td><a href='<{$SERVER_NAME}>/WorkCert/work_cert_detail?phone="+obj[i].mobile+"&vid="+obj[i].vid+"'> 查看</a> <a href='javascript:;' style='margin-left: 8px' onclick=cert_info('"+obj[i].vid+"')> 工作信息</a></td> " +
                    "</tr>";
            }
            if(index==2){
                document.getElementById("t_nopass_lst").innerHTML = s;
            }else {
                document.getElementById("t_lst").innerHTML = s;
            }
        } else {

        }
    });
    }
    function cert_info(vid) {
        url='<{$SERVER_NAME}>/WorkCert/work_cert.html?vid='+vid;
        layer.open({
            title:'认证信息',
            type: 2,
            area: ['80%', '80%'],
            maxmin: true,
            offset:'100px',
            content: url,
            success: function(layero){
                layero.find('.layui-layer-min').remove();
            }
        });
    }

    //选项卡切换
    $(document).ready(function () {
        $(".feedback_ul li").click(function () {
            $(".search_table").hide().eq($(this).index()).show();
            $(".feedback_ul").find("li a").removeClass("a_active");
            $(this).children("a").addClass("a_active");

            var index = $(this).index() + 1;//获取索引
            sessionStorage.setItem("work_tab_index", index - 1);
            sessionStorage.setItem('work_cert_page', 1);
            switch (index){
                case 1:
                    get_list(index,1,0);
                    break;
                case 2:
                    var value=$("#type_status option:selected").val();
                    console.log('9999888',value);
                    get_list(index,1,value);
                    break;
            }
        });


    });
</script>

</body>
</html>